#ifndef jjb_agent
#define jjb_agent

#include <string>
#include <bitset>
#include "solutionpool.h"

using namespace std;

class agent
{
public:
    agent(string sName, solutionpool* spPool) : theName(sName), thePool(spPool) {}

    //virtual void run();

    void insert(solution* theSolution, solution* parent1 = NULL, solution* parent2 = NULL);

    // For the training records indicated by a true in the bit set, find a split.     
    // If nFldNo is -1, then choose a random field, otherwise use the field specified
    // Return a node with the split, or NULL is no splits could be generated that maintain
    //    the minimum leaf size
    node* determineSplit(bitset<TRAIN_RECORD_COUNT>* includeRecs, int nFldNo = -1);

    node* determineSplitContinuous(bitset<TRAIN_RECORD_COUNT>* includeRecs, int nFldNo = -1);
    node* determineSplitSymbolic(bitset<TRAIN_RECORD_COUNT>* includeRecs, int nFldNo = -1);

    double calcEntropy(int left[], int right[]);

protected:
    string theName; 
    solutionpool* thePool;
};

#endif
